package com.haier.vo;

import java.io.Serializable;

import com.haier.constant.ResponseCodeConstant;

public class ResponseVo implements Serializable {
	private static final long serialVersionUID = 1L;
	private String code;
	private String msg;
	private Object data;

	public static ResponseVo success() {
		return ResponseVo.success(null);
	}

	public static ResponseVo success(Object data) {
		ResponseVo vo = new ResponseVo();
		vo.setCode("200");
		vo.setData(data);
		vo.setMsg("操作成功");
		return vo;
	}

	public static ResponseVo checkError(String msg) {
		ResponseVo vo = new ResponseVo();
		vo.setCode(ResponseCodeConstant.CHECK_ERROR);
		vo.setMsg(msg);
		return vo;
	}

	public static ResponseVo tokenError() {
		ResponseVo vo = new ResponseVo();
		vo.setCode(ResponseCodeConstant.TOKEN_ERROR);
		vo.setMsg("token校验失败");
		return vo;
	}

	public static ResponseVo error() {
		return ResponseVo.error("系统错误");
	}

	public static ResponseVo error(String msg) {
		ResponseVo vo = new ResponseVo();
		vo.setCode(ResponseCodeConstant.ERROR);
		vo.setMsg(msg);
		return vo;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

}
